fix(monitor): use optionalChains for WalletConnect Safe compatibility - #596
Open
GTC6244 wants to merge 1 commit into
Open
fix(monitor): use optionalChains for WalletConnect Safe compatibility#596GTC6244 wants to merge 1 commit into
GTC6244 wants to merge 1 commit into
Conversation
Gnosis Safe (and any smart-contract wallet) only supports the single chain it was deployed to. Passing `chains: [id]` to @walletconnect/ethereum-provider builds a requiredNamespaces entry, which Reown documents as incompatible with SCWs: the session pairs (the Safe app opens) but eth_sendTransaction never routes to the wallet, so the transaction to sign silently disappears. Switch to `optionalChains` so the Safe can negotiate its single chain while EOA wallets keep working. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes WalletConnect transaction signing in the Monitor dApp when used through a Gnosis Safe (smart-contract wallet) by changing the WalletConnect Ethereum Provider initialization to negotiate the chain as optional rather than required.
Changes:
- Switch WalletConnect init from
chains: [chainId]tooptionalChains: [chainId]to avoidrequiredNamespacesbehavior that can preventeth_sendTransactionfrom routing to Safe. - Add detailed inline rationale and a link to Reown documentation explaining the smart-contract wallet incompatibility with required namespaces.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signing with WalletConnect + a Gnosis Safe in the Monitor dApp broke: the Safe app opened but the transaction to sign never appeared. Root cause is that the Monitor's WalletConnect init passed
chains: [chainId], which@walletconnect/ethereum-providercompiles into arequiredNamespacesentry — and Reown documents required namespaces as incompatible with smart-contract wallets like Safe (which only support the single chain they were deployed to), so the session pairs buteth_sendTransactionnever routes to the wallet. This switches tooptionalChains: [chainId]so the Safe can negotiate its single chain while EOA wallets (MetaMask/Rabby) keep working; methods are left to default to the full OPTIONAL_METHODS set. No automated coverage exists for WalletConnect+Safe, so this needs a manual verification pass against a live Safe on Base before landing. Note:lit-static/wallet_connect.js(dashboard billing flow) has the same latent pattern but was left untouched to avoid regressing its typed-data namespace guarantee.🤖 Generated with Claude Code